/*
 * SystemServer.h
 *
 *  Created on: 2021年9月6日
 *      Author: vicent-PC
 */

#ifndef MAIN_ROSE_SYSTEMSERVER_H_
#define MAIN_ROSE_SYSTEMSERVER_H_
#include "Activity.h"
#include "InputEventMgr.h"

class SystemServer {
 public:
    SystemServer();
    virtual ~SystemServer();
    static SystemServer* getInstance() {
        if (m_pInstance == nullptr) m_pInstance = new SystemServer();
        return m_pInstance;
    }

    void dispatchKeyEvent();
    void registerEventListener(Activity& activity);
    void activeFG_ActivityEventListener();
    void registerEventSrc(InputEventMgr* pInputEventMgr);
    void startActivity(Activity* activity);

    void startSWsyncThread();
    void stopSWsyncThread();

    static void swSyncLoop2(void *server);

 public:
    static SystemServer* m_pInstance;
    bool mSwSyncEnable = false;
    int mSwSyncFps = 2;

 private:
    Activity* mForeActivity = nullptr;
    InputEventMgr* mpInputEventMgr = nullptr;
    void * mTimerHandler = nullptr;
};

#endif /* MAIN_ROSE_SYSTEMSERVER_H_ */
